import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { SceneFileRelationalService } from './scene_file_relational.service';
import { CreateSceneFileRelationalDto } from './dto/create-scene_file_relational.dto';
import { UpdateSceneFileRelationalDto } from './dto/update-scene_file_relational.dto';

@Controller('scene-file-relational')
export class SceneFileRelationalController {
  constructor(
    private readonly sceneFileRelationalService: SceneFileRelationalService,
  ) {}

  @Post('createRelation')
  create(@Body() createSceneFileRelationalDto: CreateSceneFileRelationalDto) {
    return this.sceneFileRelationalService.create(createSceneFileRelationalDto);
  }

  @Get()
  findAll() {
    return this.sceneFileRelationalService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.sceneFileRelationalService.findOne(id);
  }

  @Get('getFileTypeBySceneId/:sceneId/:fileType')
  getFileTypeBySceneId(
    @Param('sceneId') scene_id: string,
    @Param('fileType') fileType: string,
  ) {
    return this.sceneFileRelationalService.getFileTypeBySceneId(
      scene_id,
      fileType,
    );
  }

  @Patch(':id')
  update(
    @Param('id') id: string,
    @Body() updateSceneFileRelationalDto: UpdateSceneFileRelationalDto,
  ) {
    return this.sceneFileRelationalService.update(
      id,
      updateSceneFileRelationalDto,
    );
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.sceneFileRelationalService.remove(id);
  }

  @Delete('removeRelationByFileId/:fileId')
  removeRelationByFileId(@Param('fileId') fileId: string) {
    return this.sceneFileRelationalService.removeRelationByFileId(fileId);
  }

  @Post('getFilesIsUsedByScence')
  getFilesIsUsedByScence(@Body() param) {
    return this.sceneFileRelationalService.getFilesIsUsedByScence(param);
  }

  @Post('updateScenceToFileRelationItemByFileIdScenceId')
  updateScenceToFileRelationItemByFileIdScenceId(@Body() updateSceneFileRelationalDto: UpdateSceneFileRelationalDto){
    return this.sceneFileRelationalService.updateScenceToFileRelationItemByFileIdScenceId(updateSceneFileRelationalDto)
  }

  @Post('getScenceToFileRelationItemByFileIdScenceId')
  getScenceToFileRelationItemByFileIdScenceId(@Body() param) {
    return this.sceneFileRelationalService.getScenceToFileRelationItemByFileIdScenceId(param);
  }

  @Get('getIsUsedByFileId/:fileuuid')
  getIsUsedByFileId(@Param('fileuuid') fileuuid: string){
    return this.sceneFileRelationalService.getIsUsedByFileId(fileuuid)
  }

}
